import logging
import os

from selenium.webdriver.common.by import By
import time
from Base.Base import Base


class Page2(Base):
    by1 = (By.XPATH, '//*[@id="3001"]/div/div/div/div[1]/h3/div/a')
    by2 = (By.XPATH, '//*[@id="1"]/div/div/div/div[1]/div/h3/a/div/div/p/span/span/span')
    by3 = (By.XPATH, '//*[@id="content_left"]/div[4]/div/div/div/div/div[1]/div/div/h3/div/a')
    by4 = (By.XPATH, '//*[@id="3"]/div/div/div/div[1]/div/h3/a/div/div/p/span/span/span')

    def den_dy1(self):
        varone = self.find_selent(self.by1).text
        return varone

    def den_dy2(self):
        ter = self.find_selent(self.by2).text
        return ter

    def den_dy3(self):
        selle = self.find_selent(self.by3).text
        return selle

    def den_dy4(self):
        fell = self.find_selent(self.by4).text
        return fell
    # 抓取第一页搜索的所有网站的标题
    def den_go(self):
        self.open_url(os.getenv('by-url'))
        assert self.den_dy1() is '软件测试'
        assert self.den_dy2() is '软件测试'
        assert self.den_dy3() is '软件测试'
        assert self.den_dy4() is '软件测试'
        self.waitsp(5)
